﻿/******************************************************************************
 * GBlogTypes.cs
 * 
 * This module implements the DataContract types needed to query Google Blogs
 * 
 * Date:   12/2008
 * 
 * Copyright (c) 2009, Mark Betz 
 * 
 * All rights reserved. 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met: 
 * 
 *   * Redistributions of source code must retain the above copyright 
 *     notice, this list of conditions and the following disclaimer. 
 *   * Redistributions in binary form must reproduce the above copyright 
 *     notice, this list of conditions and the following disclaimer in the 
 *     documentation and/or other materials provided with the distribution. 
 *   * Neither the name of the Author nor the names of contributors may be 
 *     used to endorse or promote products derived from this software
 *     without specific prior written permission. 
 *     
 * THIS SOFTWARE IS PROVIDED BY MARK BETZ ''AS IS'' AND ANY  EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL MARK BETZ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 * 
 */
using System;
using System.Runtime.Serialization;

namespace GSearch
{
    /// <summary>
    /// Implements the blog-specific portion of the Google result json object
    /// </summary>
    [DataContract]
    public class GBlogResults : GResults
    {
        /// <summary>
        /// A System.String containing the title of the blog post, with
        /// HTML formatting.
        /// </summary>
        [DataMember(Name = "title")]
        public string Title { get; set; }

        /// <summary>
        /// A System.String containing the title of the blog post, without
        /// any HTML formatting
        /// </summary>
        [DataMember(Name = "titleNoFormatting")]
        public string TitleNoFormatting { get; set; }

        /// <summary>
        /// A System.String containing the URL address of the original blog
        /// post.
        /// </summary>
        [DataMember(Name = "postUrl")]
        public string PostUrl { get; set; }

        /// <summary>
        /// A System.String containing a HTML-formatted snippet of content from
        /// the blog post.
        /// </summary>
        [DataMember(Name = "content")]
        public string Content { get; set; }

        /// <summary>
        /// A System.String containing the name of the author of the blog post,
        /// if known.
        /// </summary>
        [DataMember(Name = "author")]
        public string Author { get; set; }

        /// <summary>
        /// A System.String containing the URL address of the blog on which the
        /// post appeared.
        /// </summary>
        [DataMember(Name = "blogUrl")]
        public string BlogUrl { get; set; }

        /// <summary>
        /// A System.String containing the date on which the blog post was
        /// published.
        /// </summary>
        [DataMember(Name = "publishedDate")]
        public string PublishedDate { get; set; }
    }

    /// <summary>
    /// Implements the blog-specific portion of the Google responseData json object
    /// </summary>
    [DataContract]
    public class GBlogResponseData : GResponseData
    {
        /// <summary>
        /// Returns an array of <see cref="GSearch.GBlogResults"/> objects containing
        /// the results of a blog search.
        /// </summary>
        [DataMember(Name = "results")]
        public GBlogResults[] Results { get; set; }
    }

    /// <summary>
    /// Implements the blog-specific portion of the Google response json object
    /// </summary>
    [DataContract]
    public class GBlogResponse : GResponse
    {
        /// <summary>
        /// An instance of <see cref="GSearch.GBlogResponseData"/> containing the
        /// results of a blog search.
        /// </summary>
        [DataMember(Name = "responseData")]
        public GBlogResponseData Response { get; set; }
    }
}